<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html>
	<head>
		<meta charset="utf-8">
		<title>求职者首页</title>
		<link rel="stylesheet" type="text/css" href="layui/css/layui.css" media="all"/>
		<script src="layui/layui.js" type="text/javascript" charset="UTF-8"></script>
		<script src="js/jquery-3.6.3.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		layui.use('carousel', function(){
		  var carousel = layui.carousel;
		  //建造实例
		  carousel.render({
			elem: '#test1'
			,width: '100%'    //设置容器宽度
			,height:'100%'
			,arrow: 'always'//始终显示箭头
			,autoplay: 'true',
			//,anim: 'updown' //切换动画方式
		  });
		});
		//当页面一加载时就向后台发送post请求,获取当前用户的姓名
		$(function(){
			$.post("../getusername",function(obj){
				$("#roleName").html(obj.name);
			},"json")
		});

		$.ajax({
			type: 'get',
			url: window.location.protocol + '//' + window.location.host + '/qzPageData',
			success: function (data) {
				//while (data.size)
				var count = 1;
				for (let i = (data.length - 1); i >= 0; i--) {
						if (data[i].u_name !== "admin") {
							var zid = data[i].id;
							$('#zp_ul').append("<li style='padding-top:10px; font-size: 20px;'>" + "<span class='layui-col-md10'>" +
									"<i class='layui-icon layui-icon-triangle-r'></i>" + "&nbsp;<a href='/zixunDetail?id="
									+zid+"'>" + data[i].title + "</a></span>" +
									"<span class='layui-col-md2'>" + data[i].time + "</span></li>" + "<hr>");
							count++;
						}
					if (count === 9)
						break;
				}
				count = 1;
				for (let i = (data.length - 1); i >= 0; i--) {
					if (data[i].u_name == "admin") {
						var aid = data[i].id;
						$('#ad_ul').append("<li style='padding-top:10px; font-size: 20px;'>" + "<span class='layui-col-md10'>" +
								"<i class='layui-icon layui-icon-triangle-r'></i>" + "&nbsp;<a href='/zixunDetail?id="
								+aid+"'>" + data[i].title + "</a></span>" +
								"<span class='layui-col-md2'>" + data[i].time + "</span></li>" + "<hr>");
						count++;
					}
					if (count === 9)
						break;
				}

			},
			error: function () {
				var txt3=document.createElement("p");  // 以 DOM 创建新元素
				txt3.innerHTML="数据加载异常！";
				$("#zp_ul").append(txt3);
			}
		});

	</script>
	</head>

	<body>
		<div style="margin: auto 0;">123</div>
		<div class="layui-layout layui-layout-admin" th:fragment="hade">
			<div class="layui-header layui-bg-blue">
				<div class="layui-logo layui-hide-xs layui-bg-black">高校勤工助学平台</div>
				<!-- 头部区域（可配合layui 已有的水平导航） -->
				<ul class="layui-nav layui-layout-left" lay-filter="navleft">
				  <!-- 移动端显示 -->
					<li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
						<i class="layui-icon layui-icon-spread-left"></i>
					</li>
					<li class="layui-nav-item layui-hide-xs" ><a href="/toQzIndex">首页</a></li>
					<li class="layui-nav-item layui-hide-xs" ><a href="/toGwsqIndex" id="gwsq">岗位申请</a></li>
					<li class="layui-nav-item layui-hide-xs">
						<a href="javascript:;">我的申请</a>
						<dl class="layui-nav-child"> <!-- 二级菜单 -->
							<dd><a href="/toWdsqIndex">正在申请</a></dd>
							<dd><a href="/toWdsqIndex1">申请结果</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item layui-hide-xs" ><a href="/toQzCenter" id="grzx">个人中心</a></li>
					<li class="layui-nav-item layui-hide-xs" >
						<a href="javascript:;">联系反馈</a>
						<dl class="layui-nav-child" >
							<dd><a lay-event="fankui">反馈信息</a></dd>
							<dd>
								<a >微信扫一扫</a>
								<img style="width: 200px;height: 200px;" src="img/公众号1.jpg">
							</dd>
						</dl>
					</li>
				</ul>
				<ul class="layui-nav layui-layout-right" lay-filter="demo">
				  <li class="layui-nav-item layui-hide layui-show-md-inline-block">
					  <a href="javascript:;">
						<img src="//cdn.ilayuis.com/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" tppabs="http://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img">
						<span id="roleName">用户</span>
						<i class="layui-icon layui-icon-down layui-nav-more"></i>
					  </a>
					<dl class="layui-nav-child">
					  <dd><a lay-event="change">修改密码</a></dd>
					  <dd><a href="/loginOut">退出登录</a></dd>
					</dl>
				  </li>
				</ul>
			</div>
			  
			<div class="layui-fluid" style="width: 80%; height: 500px; margin-top:75px;">
				<div class="layui-carousel" id="test1">
				  <div carousel-item>
					  <div><a href=""><img src="img/轮播1.jpg" style="width: 100%; height:auto;" /></a></div>
					  <div><a href=""><img src="img/轮播2.png" style="width: 100%; height:auto;" /></a></div>
					  <div><a href="/toGwsqIndex"><img src="img/轮播3.png" style="width: 100%; height:auto;" /></a></div>
				  </div>
				</div>
				<!-- 条目中可以是任意内容，如：<img src=""> -->
			</div>


			<div class="layui-container" style="width: 80%;">
				<!-- 内容主体区域 -->
				<div class="layui-row layui-col-space15" style="margin-top:30px;">
				  <div class="layui-col-md6">
				    <div class=" layui-panel" style="padding: 30px;">
						<div class="layui-card-header" style="color: #007DDB">
							<h2 class="layui-col-md10">招聘单位公告栏</h2>
							<h2 class="layui-col-md2"><a href="/toZpZixunMore" style="color: #007DDB;">&nbsp;&nbsp;&nbsp;更多&nbsp;&nbsp;<i class="layui-icon layui-icon-next"></i></a></h2>
						</div>
						<div class="layui-card-body">
							<ul style="height: 380px">
								<li id="zp_ul"></li>
							</ul>
						</div>
				    </div>   
				  </div>
				  <div class="layui-col-md6">
				    <div class="layui-panel" style="padding: 30px;">
						<div class="layui-card-header" style="color: #007DDB">
						<h2 class="layui-col-md10">系统公告栏</h2>
						<h2 class="layui-col-md2"><a href="/toAdZixunMore" style="color: #007DDB;">&nbsp;&nbsp;&nbsp;更多&nbsp;&nbsp;<i class="layui-icon layui-icon-next"></i></a></h2>
						</div>
						<div class="layui-card-body">
								<ul style="height: 380px">
									<li id="ad_ul"></li>
								</ul>
						</div>
				    </div>   
				  </div>
				</div>
				   <br><br><br>
				  
					<div class="layui-card layui-panel">
						<div class="layui-card-header">

						</div>
						<div class="layui-card-body">
						</div>
					</div>
					<br><br>
			</div>
			  
		</div>
	</body>

	<script src="js/nav.js"></script>

</html>
